#for i in range(1,10+1,2):#0_9
 #  print(i,end="\t")
from random import randint

#打印100以内能被3整除的数字
#for  i in range(1,100+1):
  #  if i %3==0:
    #    print(i,end="\t")


#猜数字
#产生随机数
#num =randint(1,20)
#while True:
 #   guess=int(input("请输入一个数字"))
  #  if guess>num:
   #     print("太大了")
    #elif guess < num:
     #   print("太小了")
    #else:
     #   print("猜对了")
      #  break#


#逢7过
for i in range(1,100+1):
   # if i%7==0 or str(i).find('7')!=-1:
   if i % 7 == 0 or str(i).count('7') >0:
#   if i % 7 == 0 or '7'in str(i)!=-1:#三种写法
      print(i, end="\t")



#打印菱形
for i in range(1,11+1,2):
   print(("*"* i).center(11) )   #center字符串居中
for i in range(9,0,-2):
   print(("*"* i).center(11) )



#打印菱形2多层嵌套
row = eval(input('请输入菱形的行数：'))
while row % 2 == 0:  # 判断行数的奇偶性
    print('请重新输入菱形的行数：')
    row = eval(input('请输入菱形的行数：'))
top_row = (row + 1) // 2  # 上半部分的行数
for i in range(1, top_row + 1):
    for j in range(1, top_row + 1 - i):
        print(' ', end='')
    for k in range(1, i * 2):
        print('*', end='')
    print()
# 下半部分
bottom_row = row // 2
for i in range(1, bottom_row + 1):
    for j in range(1, i + 1):
        print(' ', end='')
    for k in range(1, bottom_row * 2 - 2 * i + 2):  # 1-->range(1,6),2-->range(1,4),3-->range(1,2),
        print('*', end='')
    print()


#打印水仙花数(水仙花数是指一个n位正整数，它的各位数字的n次幂之和等于它本身。例如，153是一个3位数)
for num in range(100, 1000):
    three = num // 100
    two= (num // 10) % 10
    one = num % 10
    if num == three**3 + two**3 + one**3:
        print(num)

#打印100以内质数
#def is_prime(num):
 #   if num <= 1:
  #      return False
   # for i in range(2, int(num ** 0.5) + 1):
    #    if num % i == 0:
     #       return False
    #return True
#for i in range(2, 100):
 #   if is_prime(i):
  #      print(i)


#打印斐波那契数列
#def fibonacci(num):
 #   if num <= 0:
  #      fib_list = []
   # elif num == 1:
    #    fib_list = [1]
    #elif num >= 2:
     #   fib_list = [1, 1]
    #if num >= 3:
     #   for i in range(num - 2):
      #      fib_list.append(fib_list[i] + fib_list[i + 1])
    # 打印范围内的斐波那契数列
    #for i in fib_list:
     #   if i <= num:
      #      print(i, end=' ')
    # 3是个特例，需要单独处理
    #if len(fib_list) == 3:
     #   print(3, end=' ')
    #elif fib_list == []:
     #   print('空', end=' ')
    #print()
    #return fib_list
# 调用函数打印斐波那契而数列
#while True:
 #   num = int(input('请输入斐波那契数列长度的整数：'))
  #  print('范围内：', end='')
   # print(f'长度：{fibonacci(num)}')

#打印九九乘法表
#for i in range(1,10+1):
 #  for j in range (1,i+1):
  #    # print(j+"*"+"i"+"="+j*i,end="\t" )
   #    print("%d*%d=%d"%(j,i,j*i),end="\t")
   #print()

#打印100以内的完数
#for i in range(1,101):
   # sum = 0
   # for j in range(1,i):
   #     if i % j == 0:
    #        sum += j
    #if sum == i:
     #   print(f"{i}是完数")

